
{{if isset($data['item'])}}
{{if count($data['item'])==0}}
    <div style="min-height: 250px;"><p style="font-size: 18px; margin: 15px 20px;">Không tìm thấy sản phẩm có từ khóa <span style="color: #666666;font-weight: bold;">"{{$keyword}}"</span></p></div>
{{else}}
<ul>
    {{foreach $data['item'] as $item}}
    {{if isset($category)}}{{$parent_code = $category->get_parent_category($item->category_id)->code}}{{/if}}
    {{$url = 'san-pham/'|cat:$parent_code|cat:'/'|cat:$item->category_code|cat:'/'|cat:$item->code}}
    <li>
        <a href="{{$url|base_url}}"><img src="{{$item->image|base_url}}" title="{{$item->title}}"></a>
        <div class="price_list">{{if $item->old_price!=$item->new_price}}<span>{{$item->old_price|vnd_format:''}}<sup>đ</sup></span> | {{/if}}{{$item->new_price|vnd_format:''}}<sup>đ</sup></div>
        <p class="name_pro"><a title="{{$item->title}}" href="{{$url|base_url}}">{{$item->title|escape:'html'}}</a></p>
        <p class="summary">{{$item->description|truncate:75:'...'|escape:'html'}}</p>
        <div class="wrap_btn top">
            <form action="{{'cart/add_cart_item'}}" method="post" id="frm_{{$item->id}}">
                <a href="javascript:;" onclick="addItemToCart({{$item->id}});" class="btn_add"></a><a class="btn_info"></a>
                <input type="hidden" name="proid" id="item-{{$item->id}}" value="{{$item->id}}" />
            </form>
        </div>
        {{if $item->old_price!=$item->new_price}}<div class="sale small list"><span>Giảm <abbr>{{saleprice old_price=$item->old_price new_price=$item->new_price}}%</abbr></span></div>{{/if}}
    </li>
    {{/foreach}}
</ul>

{{/if}}
<div class="clr"></div>
{{include file='../../frontend/subs/pagination.tpl'}}
<script type="text/javascript">
    {{if isset($type)}}
        var _type ='{{$type}}';
    {{/if}}
    function pagination(_p){
        //$("#list-product").html("<p style='color: #000;padding: 14px 0 0 36px;'>Đang tải dữ liệu...</p>");
        var surl="{{"home/pagination"|base_url}}";
        var odata={
            p   :   _p,
            type:   _type
        };
        jQuery.ajax({
            type:"POST", 
            data:odata, 
            dataType:"text", 
            url:surl, 
            success: function (data){
                isrunning=false;
                $("#list-product").html(data);
            },
            error: function (xhr, ajaxOptions, thrownError){
                isrunning=false;
                alert("Hệ thống đang bận hoăc bảo trì.\nVui lòng thử lại sau ít phút.");
            }
        });
    }
</script>
{{/if}}